<template>
  <global-header :user="user"></global-header>
  <loader v-if="isLoading" text="加载中" background="rgba(0,0,0,.5)"></loader>
  <router-view />
  <global-footer></global-footer>
</template>
<script lang="ts">
import { defineComponent, computed } from 'vue'
import { useStore } from 'vuex'
import GlobalHeader from '@/components/GlobalHeader.vue'
import GlobalFooter from '@/components/GlobalFooter.vue'
import Loader from '@/components/Loader.vue'
import { IStore } from '@/types/index'
export default defineComponent({
  name: 'App',
  components: {
    GlobalHeader,
    GlobalFooter,
    Loader
  },
  setup() {
    const store = useStore<IStore>()
    const user = computed(() => store.state.user)
    const isLoading = computed(() => store.state.loading)
    return {
      user,
      isLoading
    }
  }
})
</script>
